package com.sqx.modules.fixedClassify.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sqx.common.utils.Result;
import com.sqx.modules.fixedClassify.entity.FixedClassify;
import com.sqx.modules.fixedClassify.service.FixedClassifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jaudiotagger.fix.Fix;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(value = "一口价分类", tags = {"用户端:一口价分类"})
@RequestMapping(value = "/app/fixedClassify")
public class AppFixedClassifyController {
    @Autowired
    private FixedClassifyService classifyService;

    @ApiOperation("获取Tree分类列表")
    @GetMapping("getTreeClassifyList")
    public Result getTreeClassifyList(FixedClassify fixedClassify) {
        fixedClassify.setIsEnable(1);
        return Result.success().put("data", classifyService.getTreeClassifyList(fixedClassify));
    }

    @ApiOperation("获取分类列表(非Tree)")
    @GetMapping("getClassifyList")
    public Result getClassifyList(FixedClassify fixedClassify) {
        fixedClassify.setIsEnable(1);
        return Result.success().put("data", classifyService.getClassifyList(fixedClassify));
    }

    @ApiOperation("根据师傅去获取分类")
    @GetMapping("getClassifyListByUserId")
    public Result getClassifyListByUserId(Long userId) {
        return Result.success().put("data", classifyService.getClassifyListByUserId(userId));
    }


    @ApiOperation("获取分类信息")
    @GetMapping("getClassifyById/{classifyId}")
    public Result getClassifyInfo(@PathVariable("classifyId") Long classifyId) {
        return Result.success().put("data", classifyService.getById(classifyId));
    }


}
